﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DepInnerTask.Common.Interface;
using Common.Service;
using System.Collections;
using DepInnerTask.Common.Entity;
using System.IO;
using IBatisNet.DataMapper;
using Common;
using DepInner;

namespace Ultimus.Web
{
    public partial class TaskStop : System.Web.UI.Page
    {
        IExceptionLog log = ServiceContainer.GetService<IExceptionLog>();
       
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                txtExDate.Text = DateTime.Now.ToShortDateString();
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ExceptionLogEntity logentity = new ExceptionLogEntity();
            logentity.DOCUMENT_NUMBER = txtNo.Text.Trim();
            logentity.TITLE = txtTitile.Text;
            logentity.EXCEPTION_TYPE = drpExList.SelectedItem.Text;
            logentity.STEP_NAME = txtHuanjie.Text;
            logentity.TASK_ID = txtTaskNo.Text;
            logentity.CLOSE_STEP_NAME = txtCloseHuanjie.Text;
            logentity.ACTION_BY = txtExUser.Text;
            logentity.ACTION_DEPARTMENT = txtExDep.Text;
            logentity.ACTION_DATE =Convert.ToDateTime(txtExDate.Text);
            logentity.EXCEPTOIN_REASON = txtExReason.Text;
            logentity.EXCEPTOIN_CONDITION = txtExBasis.Text;
            logentity.EXCEPTION_ID = Guid.NewGuid().ToString();
            if (rbtnYes.Checked)
            {
                logentity.FOLLOW_UP = "1";
            }
            else
            {
                logentity.FOLLOW_UP = "2";
            }
          
            log.Insert(logentity);
            MessageBox("添加记录成功！");
           // Response.Redirect("TaskStop.aspx");
        }
        #region 封装弹出信息
        private void MessageBox(string name)
        {
            Response.Write("<script type='text/javascript'>alert('" + name + "');</script>");
        }
        #endregion
        protected void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("TaskStop.aspx");
        }
    }
}